#import "RemoteController.h"

@implementation RemoteController

- start:sender
{
	id	ourPort;

	if( !camera )
	{
		camera = [NXConnection connectToName:"localhost/NDCamera" onHost:"*"];
		ourPort = [camera connectionForProxy];
		[ourPort runFromAppKit];
	}

	if( camera )
	{
		[camera start:nil];
	}
	return self;
}

- stop:sender
{
	if( camera )
	{
		[camera stop:nil];
	}
	return self;
}

- pause:sender
{
	if( camera )
	{
		// well..does nothing right now...it the future it might stop the
		// continuous frame grabbing.
	}
	return self;
}

- record:sender
{
	if( camera )
	{
		[camera grab:nil];

		// In a custom version you might call ZAP or any other VCR controlling
		// code from here to ensure that it will advance two images before
		// you let the camera grab another two shots.

		// [MiscZAPShell executeFromString:"zap ~/advanceTwoFrames"];

		// Now ensure that another grab will come soon.
		// Perhaps one should chance the way the button behaves...it might
		// stay highlighted etc. pp.

		// [Application perform:@selector(grab:) with:self andTarget:self
		//			afterDelay:10 cancelPrevious:NO];
		//
		// ...ummh which is from the top of my head...perhaps the method is 
		// slightliy different.
	}
	return self;
}

- takeNewCassette:sender
{
	if( camera )
	{
		[camera adjustOutputFile:sender];
	}
	return self;
}

@end